<template>
  <section class="main">
    <div class="logo text-center">
      <h1> <a href="index.html"> Universe Sign In Form</a></h1>
    </div>
    <div class="content-w3ls text-center">
      <img src="/static/images/admin.png" alt="" class="img-responsive">
<!--      <form>-->
        <div class="wthree-field">
          <input v-model="userInfo.username" id="text1" type="text" placeholder="Username" required>
        </div>
        <div class="wthree-field">
          <input v-model="userInfo.pwd"  id="myInput" type="Password" placeholder="Password">
        </div>
        <div class="wthree-field">
          <button @click="log" class="btn">Sign In</button>
        </div>
        <div class="login-bottom">
          <a href="#url" class="">Create An Account</a>
        </div>
<!--      </form>-->
    </div>
  </section>
</template>

<script setup>
import "/static/css/style.css"
import "/static/font/ggfont.css"
</script>
<script>
export default {
  name:'log',
  data(){
    return{
      userInfo:{
        username:'',
        pwd:''
      }
    }
  },
  methods:{
    log(){
      this.$axios.post('/api/login',this.userInfo).then((res)=>{
        if (res.data.log){
          this.$jumpByName.jumpByName("loginSuc")
          this.$setLocal.setLocal(res.data.user,"user")
        }
        this.$setLocal.setLocal(res.data.tk,"tk")
      })
    }
  }
}
</script>

<style scoped>

</style>